package com.foreknow.demo9;

import java.awt.*;
import java.awt.event.ActionListener;

/**
 * 接口在实际项目中的应用
 */
public class WindowFrame extends Frame {
    //初始化页面
    public WindowFrame(String title) {
        Button button = new Button("button");
        //ActionListener action = new ActionListenerImpl(); //父类的引用指向子类的对象
        button.addActionListener(new ActionListenerImpl());
        setTitle(title);
        setSize(400,400);
        add(button);
        setVisible(true);
    }
    public static void main(String[] args) {
        WindowFrame frame = new WindowFrame("这是一个窗口");
    }
}
